package com.wm.factory;

/**
 * @ClassName: Factory
 * @Description: 工厂类
 * @Author: WM
 * @Date: 2022/8/10 13:42
 **/
public class Factory {
    /**
     * 根据入参决定要实例化哪个对象
     *
     * @param phoneName
     * @return
     */
    public Phone createPhone(String phoneName) {
        if ("HuaWei".equals(phoneName)) {
            return new HuaWei();
        } else if ("IPhone".equals(phoneName)) {
            return new IPhone();
        }
        return null;
    }
}
